package me.keiwu.pub.rpc;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by kei on 03/11/2017.
 */
public interface LogLoginRpcPub {


    @RequestMapping("/rpc/log/login/daily")
    String dailyLogin(@RequestParam(value = "nickName", required = false) String nickName,
                      @RequestParam("page") Integer page,
                      @RequestParam("size") Integer size);
    @RequestMapping("/rpc/log/login/history")
    String historyLogin(@RequestParam(value = "nickName", required = false) String nickName,
                        @RequestParam("page") Integer page,
                        @RequestParam("size") Integer size);

    @Async
    @RequestMapping("/rpc/log/login/log")
    void logLogin(@RequestParam("userId") Long userId,
                  @RequestParam("nickName") String nickName,
                  @RequestParam("channel") String channel,
                  @RequestParam("loginTime") Integer loginTime);



    @Component
    class Hystrix implements LogLoginRpcPub {

        @Override
        public String dailyLogin(String nickName, Integer page, Integer size) {
            return null;
        }

        @Override
        public String historyLogin(String nickName, Integer page, Integer size) {
            return null;
        }

        @Override
        public void logLogin(Long userId, String nickName, String channel, Integer loginTime) {

        }

    }

}
